<?php 
	include('../includes/db_exe/db_connection');
?>
<?php 
	if($_SERVER['REQUEST_METHOD']=='POST'){
		if(isset($_FILES['image'])) {
			//tao array trong cho bien error
			$errors = array();

			//tao array kiem tra xem file image upload co thuoc dinh dang cho phep khong
			$allowed = array('image/jpg','image/png','image/jpeg'.'imgage/x-png');

			//kiem tra file duoc upload co thuoc dinh danh cho phep, khong thi bao loi
			if(in_array(strtolower($_FILES['image']['type']), $allowed)){

				//neu nam trong dinh dang cho phep thi tach lay phan mo rong
				$ext = end(explode('.', $_FILES['image']['tmp_name']));
				$rename = uniqid(rand(),true).'.'.$ext;

				move_uploaded_file(filename, destination);
			}
		}
	}
?>